package com.zzl.finance.order.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzl.finance.order.dao.InvoiceTitleDao;
import com.zzl.finance.order.dto.InvoiceTitleAddDto;
import com.zzl.finance.order.dto.InvoiceTitleUpdateDto;
import com.zzl.finance.order.entity.InvoiceTitleEntity;
import com.zzl.finance.order.service.InvoiceTitleService;
import com.zzl.general.common.exception.SysException;
import com.zzl.general.common.serurity.entity.User;
import com.zzl.general.common.utils.PageUtils;
import com.zzl.general.common.utils.Query;
import com.zzl.general.common.utils.UuidUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 
 * @author hyt 
 * @date 2021-09-13 18:06:44
 */
@Service
public class InvoiceTitleServiceImpl extends ServiceImpl<InvoiceTitleDao, InvoiceTitleEntity> implements InvoiceTitleService {

    @Override
    public PageUtils queryPage(Map<String, Object> params, User user) {
        /*TODO*/
        return null;
    }

    @Override
    public void saveEntity(InvoiceTitleAddDto addDto, User user) throws SysException {
        InvoiceTitleEntity entity = new InvoiceTitleEntity();
        BeanUtils.copyProperties(addDto, entity);
        entity.setId(UuidUtils.UUID());
        entity.setCreatorId(user.getId());
        entity.setEnterpriseId(user.getEnterpriseId());
        if (!this.save(entity)) {
            throw new SysException("新增失败！");
        }
    }

    @Override
    public void updateEntity(InvoiceTitleUpdateDto updateDto, User user) throws SysException {
        /*TODO*/
    }

    @Override
    public InvoiceTitleEntity getDefault(User user) {
        /*TODO*/
        return null;
    }
}
